package com.android.qjpmc.application_module.activity;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.android.qjpmc.R;
import com.android.qjpmc.databinding.ActivitySelectDataBinding;
import com.android.qjpmc.databinding.DeviceItemDataBinding;
import com.android.qjpmc.widget.base.BaseCommonActivity;
import com.android.qjpmc.widget.databindingadapter.BaseDataBindingDecorator;
import com.android.qjpmc.widget.databindingadapter.SingleTypeBindingAdapter;

import java.util.ArrayList;
import java.util.List;

public class SelectDataActivity extends BaseCommonActivity<ActivitySelectDataBinding> {
    @Override
    public int getLayoutId() {
        return R.layout.activity_select_data;
    }

    @Override
    public void initView() {
        super.initView();

        List<String> list=new ArrayList<>();
        list.add("");
        list.add("");
        list.add("");

        // 不可嵌套滑动
        mBinding.recyclerView.setNestedScrollingEnabled(false);
        // 取消head 的 recycleView的焦点
        mBinding.recyclerView.setFocusableInTouchMode(false);
        //设置布局管理器
        mBinding.recyclerView.setLayoutManager(new LinearLayoutManager(this));
        SingleTypeBindingAdapter adapter = new SingleTypeBindingAdapter(this, list, R.layout.device_item_data);
        mBinding.recyclerView.setAdapter(adapter);

        adapter.setItemDecorator((BaseDataBindingDecorator<String, DeviceItemDataBinding>) (binding, position, viewType, data) -> {

            // 不可嵌套滑动
            binding.itemRecyclerView.setNestedScrollingEnabled(false);
            // 取消head 的 recycleView的焦点
            binding.itemRecyclerView.setFocusableInTouchMode(false);
            //设置布局管理器
            binding.itemRecyclerView.setLayoutManager(new LinearLayoutManager(this));
            SingleTypeBindingAdapter itemAdapter = new SingleTypeBindingAdapter(this, list, R.layout.item_report_data_item);
            binding.itemRecyclerView.setAdapter(itemAdapter);

        });
    }

    @Override
    public void initData() {
        super.initData();
    }
}

